package Day15;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改
/**
 * 2021Java真题:求阶乘
 * https://www.lanqiao.cn/problems/2145/learning/
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        long k = scan.nextLong();
        long l = 1l;
        long r = Long.MAX_VALUE - 1;
        while(l < r){
          long mid = (l + r ) / 2;
          if(k <= calc(mid)){
            r = mid;
          }else{
            l = mid + 1;
          }
        }
        if(calc(r) != k){
          System.out.println(-1);
        }else{
          System.out.println(r);
        }
        scan.close();
    }

    public static long calc(long x){
      long count = 0;
      //求阶乘末尾0的个数其实就是去求阶乘因子中5的个数
      //5！= 1 * 2 * 3 * 4 * 5 = 120
      //10! = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * (2 * 5)(10) = 3628800
      //15! = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * (2 * 5) * 11 * 12 * 13 * 14 * (3 * 5)(15) = 1307674368000
      while(x != 0){
        count = count + x / 5;
        x /= 5;
      }
      return count;
    }
}